package recursion.leetcode.editor.cn;


public class PowerOfFour {
    public static void main(String[] args) {
        Solution solution = new PowerOfFour().new Solution();
        System.out.println("1:"+ solution.isPowerOfFour(1));
        System.out.println("2:"+ solution.isPowerOfFour(2));
        System.out.println("3:"+ solution.isPowerOfFour(3));
        System.out.println("4:"+ solution.isPowerOfFour(4));
        System.out.println("5:"+ solution.isPowerOfFour(5));
        System.out.println("16:"+ solution.isPowerOfFour(16));
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public boolean isPowerOfFour(int n) {
            if (n == 1) {
                return true;
            } else {
                if (n ==0||n % 4 != 0 ) {
                    return false;
                } else {
                    return isPowerOfFour(n / 4);
                }
            }
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}